package org.linlinjava.litemall.db.service;

import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallTenderQuoteMapper;
import org.linlinjava.litemall.db.domain.LitemallTenderQuote;
import org.linlinjava.litemall.db.domain.LitemallTenderQuoteExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @program: mall
 * @author: youvy
 * @create: 2019-12-27 15:11
 **/
@Service
public class LitemallTenderQuoteService {
	@Resource
	private LitemallTenderQuoteMapper mapper;

	public List<LitemallTenderQuote> list(Integer page, Integer pageSize, String sort,Integer status,Integer tenderId) {
		LitemallTenderQuoteExample example = new LitemallTenderQuoteExample();
		LitemallTenderQuoteExample.Criteria criteria = example.or();
		if (sort != null && sort.length() > 0) {
			example.setOrderByClause(sort);
		}
		if (status != null) {
			criteria.andStatusEqualTo(status);
		}
		criteria.andTenderIdEqualTo(tenderId);
		PageHelper.startPage(page, pageSize);
		return mapper.selectByExampleWithBLOBs(example);
	}

	public void insert(LitemallTenderQuote tender) {
		mapper.insert(tender);
	}

	public void update(LitemallTenderQuote tender) {
		mapper.updateByPrimaryKeyWithBLOBs(tender);
	}

	public void delete(Integer id) {
		mapper.deleteByPrimaryKey(id);
	}

/*	public LitemallTenderQuote f indByTenderIdAndBrandId(Integer id, int parseInt) {
		LitemallTenderQuoteExample example = new LitemallTenderQuoteExample();
		example.or().andTenderIdEqualTo(id).andBrandIdEqualTo(parseInt);
		return mapper.selectOneByExample(example);
	}*/
}
